//
//  singerViewController.m
//  A段项目音乐播放
//
//  Created by dllo on 15/5/21.
//  Copyright (c) 2015年 lanou3g.com蓝鸥科技. All rights reserved.
//

#import "singerViewController.h"
#import <AFNetworking/AFNetworking.h>
#import "SingerModel.h"
#import "singerTableViewCell.h"
#import "singerActionView.h"
#import "SingerHeaderController.h"
#import "PendulumView.h"
@interface singerViewController ()<UITableViewDataSource, UITableViewDelegate, celldelegate, UIScrollViewDelegate>
@property (nonatomic ,retain)PendulumView *pendulum;

@end

@implementation singerViewController
- (void)sendId:(NSInteger)num
{
    SingerHeaderController *header = [[SingerHeaderController alloc]init];
    header.num = num;
    
    [self.navigationController pushViewController:header animated:YES];
    [header release];
}

- (void)dealloc
{
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        
        
        
    }
    return self;
}

- (void) addsubview
{
//    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 300)];
//    [view setBackgroundColor:[UIColor colorWithRed:0.6 green:0.8 blue:0.8 alpha:1]];
//    [self.view addSubview:view];
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 400)];
    [view setBackgroundColor:[UIColor greenColor]];
    [self.view addSubview:view];
    
    self.mytableview = [[[UITableView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)] autorelease];
    
    self.mytableview.delegate = self;
    self.mytableview.dataSource = self;
    [self.mytableview registerClass:[singerTableViewCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:self.pendulum];
    [self.view addSubview:self.mytableview];
    [self.mytableview setBackgroundColor:[UIColor colorWithWhite:0 alpha:0]];
    self.mytableview.bouncesZoom = NO;
    [self.pendulum removeFromSuperview];
    
    
}
- (void)loadView
{
    [super loadView];
    [self.view setBackgroundColor:[UIColor whiteColor]];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    UIColor *ballColor = [UIColor colorWithRed:0.47 green:0.60 blue:0.89 alpha:1];
    self.pendulum = [[PendulumView alloc] initWithFrame:self.view.bounds ballColor:ballColor];
 
    [self addsubview];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    return 200;
//}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    singerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.delegate = self;
    
    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return ([UIScreen mainScreen].bounds.size.width / 3.2769 + 20) * 4 + 100;
}
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
{
    NSLog(@"上端");
}

//- (void)scrollViewDidScroll:(UIScrollView *)scrollView
//{
//    NSLog(@"拖动");
//    CGPoint point = scrollView.contentOffset;
//    
//    NSLog(@"%f,%f", point.x, point.y);
//    if (point.y > 0) {
//        self.mytableview.frame = CGRectMake(0, 200 - point.y, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
//    }
//    
//}
@end
